import 'package:json_annotation/json_annotation.dart';

part 'classinfo.g.dart';

@JsonSerializable()
class ClassInfo {
  String id;
  String name;
  List<StudentList> studentList;
  int isManager;
  int isIn;

  ClassInfo({this.id, this.name, this.studentList, this.isManager,this.isIn});
//反序列化
  ClassInfo.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    if (json['studentList'] != null) {
      studentList = new List<StudentList>();
      json['studentList'].forEach((v) {
        studentList.add(new StudentList.fromJson(v));
      });
    }
    isManager = json['isManager'];
    isIn = json['isIn'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    if (this.studentList != null) {
      data['studentList'] = this.studentList.map((v) => v.toJson()).toList();
    }
    data['isManager'] = this.isManager;
    data['isIn'] = this.isIn;
    return data;
  }
}

class StudentList {
  String id;
  String name;
  String state;
  int status;
  String studentHomeworkId;

  StudentList(
      {this.id, this.name, this.state, this.status, this.studentHomeworkId});

  StudentList.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    state = json['state'];
    status = json['status'];
    studentHomeworkId = json['studentHomeworkId'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['state'] = this.state;
    data['status'] = this.status;
    data['studentHomeworkId'] = this.studentHomeworkId;
    return data;
  }
}
